FROM centos:7.9.2009

RUN echo "Asia/Shanghai" > /etc/timezone && \
    cd /etc/yum.repos.d/ && \
    mv CentOS-Base.repo CentOS-Base.repo_back && \
    curl -o CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo && \
    sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo && \
    yum clean all && \
    yum makecache && \
    yum -y install epel-release && \
    yum -y update && \
    yum -y install gcc openssl-devel bzip2-devel libffi-devel zlib-devel make && \
    mkdir /data && \
    cd /data && \
    curl -o Python-3.9.16.tgz https://mirrors.huaweicloud.com/python/3.9.16/Python-3.9.16.tgz && \
    tar -xvf Python-3.9.16.tgz && \
    cd Python-3.9.16 && \
    ./configure && make && make install && \
    cd ~ && rm -rf /data && \
    yum clean all